package com.onLineCar.apply.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @Project cloud-server
 * @Author 王方俞
 * @Date 2023/12/28 10:51
 * @Description
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CustomPicture {

    private byte[] imageData;

    private String fileName;

    private String contentType;


    public void setFile(MultipartFile file) {
        try {
            this.imageData = file.getBytes();
            this.fileName = file.getOriginalFilename();
            this.contentType = file.getContentType();
        } catch (IOException e) {
            e.printStackTrace();
            // 处理异常，根据需要抛出自定义异常或其他操作
        }
    }
}
